package com.netease.pris.activity;

import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.database.ContentObserver;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import com.netease.b.a.d;
import com.netease.framework.ActivityEx;
import com.netease.framework.k;
import com.netease.pris.atom.b;
import com.netease.pris.c.l;
import com.netease.pris.d.c;
import java.util.ArrayList;
import java.util.List;

public class PRISActivityWBSetting extends ActivityEx
  implements AdapterView.OnItemClickListener
{
  public static final int a = 111;
  private static final String b = PRISActivityWBSetting.class.getCanonicalName();
  private static final int i = 1;
  private ListView c;
  private Cursor d = null;
  private ContentObserver e;
  private co f;
  private cp g;
  private int h;

  public static void a(Context paramContext)
  {
    paramContext.startActivity(new Intent(paramContext, PRISActivityWBSetting.class));
  }

  private void a(co paramco)
  {
    this.f = paramco;
    MBlogBindActivity.a(this, paramco.c);
  }

  public static boolean a(Context paramContext, b paramb)
  {
    int j = 1;
    int k;
    int m;
    if (paramb == b.c)
    {
      if (l.b(paramContext, d.h().c(), j) != null)
        break label170;
      k = 2131362185;
      m = j;
    }
    while (true)
    {
      if (m != 0)
      {
        AlertDialog.Builder localBuilder = new AlertDialog.Builder(paramContext);
        localBuilder.setIcon(2130837644);
        String str = paramContext.getString(2131362182);
        Object[] arrayOfObject = new Object[j];
        arrayOfObject[0] = paramContext.getString(k);
        localBuilder.setTitle(String.format(str, arrayOfObject));
        localBuilder.setMessage(2131362183);
        fm localfm = new fm(paramb, paramContext);
        localBuilder.setPositiveButton(2131362184, localfm);
        localBuilder.setNegativeButton(2131362053, localfm);
        localBuilder.show();
      }
      while (true)
      {
        return j;
        if ((paramb != b.b) || (l.b(paramContext, d.h().c(), 3) != null))
          break label170;
        k = 2131362186;
        m = j;
        break;
        j = 0;
      }
      label170: k = 0;
      m = 0;
    }
  }

  private void b(co paramco)
  {
    this.f = paramco;
    showDialog(1);
  }

  private void c()
  {
    if (this.f != null);
    try
    {
      l.a(this, this.f.c);
      e();
      return;
    }
    catch (Exception localException)
    {
      while (true)
        localException.printStackTrace();
    }
  }

  private void e()
  {
    CookieSyncManager.createInstance(getApplicationContext());
    CookieManager.getInstance().removeAllCookie();
    CookieSyncManager.getInstance().sync();
  }

  void a_()
  {
    this.d.requery();
    boolean bool = this.d.moveToFirst();
    ArrayList localArrayList = new ArrayList();
    localArrayList.clear();
    for (int j = 0; j < 7; j++)
    {
      co localco1 = new co(this, null);
      localco1.a = getString(2131362085);
      localco1.d = false;
      localco1.c = (j + 1);
      localArrayList.add(localco1);
    }
    if (bool)
      do
      {
        co localco2 = (co)localArrayList.get(-1 + this.d.getInt(4));
        if (localco2 == null)
          continue;
        localco2.b = this.d.getLong(0);
        localco2.a = this.d.getString(2);
        localco2.d = true;
        localco2.e = this.d.getString(7);
        localco2.f = this.d.getString(8);
      }
      while (this.d.moveToNext());
    this.g = new cp(this, this);
    this.g.a(localArrayList);
    this.g.notifyDataSetChanged();
    this.c.setAdapter(this.g);
    this.c.setOnItemClickListener(this);
  }

  void b()
  {
    this.c = ((ListView)findViewById(2131558711));
    this.c.setDivider(k.a(this).b(2130837721));
    a_();
    setTitle(2131362038);
    g(8);
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903121);
    this.d = l.a(this);
    this.e = new fi(this, new Handler());
    this.d.registerContentObserver(this.e);
    b();
  }

  protected Dialog onCreateDialog(int paramInt)
  {
    switch (paramInt)
    {
    default:
    case 1:
    }
    for (Object localObject = super.onCreateDialog(paramInt); ; localObject = new AlertDialog.Builder(this).setIcon(2130837639).setTitle(2131362056).setMessage(2131362057).setPositiveButton(2131362058, new fn(this)).setNegativeButton(2131362059, new fl(this)).create())
      return localObject;
  }

  protected void onDestroy()
  {
    if (this.d != null)
    {
      this.d.unregisterContentObserver(this.e);
      this.d.close();
    }
    this.g = null;
    super.onDestroy();
    System.gc();
  }

  public void onItemClick(AdapterView paramAdapterView, View paramView, int paramInt, long paramLong)
  {
    if (this.g != null)
    {
      co localco = (co)this.g.getItem(paramInt);
      if (!localco.d)
      {
        c.a(p(), 609, localco.c);
        a(localco);
      }
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.PRISActivityWBSetting
 * JD-Core Version:    0.6.0
 */